home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CD ROM Paradise Collection 4
/
CD ROM Paradise Collection 4 1995 Nov.iso
/
program
/
swags_z.zip
/
STRINGS.SWG
/
0059_Fast Upper-Lower Case.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
1993-09-26
|
1KB
|
64 lines
(*
From: LEE BARKER
Subj: FAST Up/Low Case CORRECTION
*)
Uses CRT;
function LoStr(const s:string):string; assembler;
asm
push ds
lds si,s
les di,@result
lodsb { load and store length of string }
stosb
xor ch,ch
mov cl,al
jcxz @empty { FIX for null string }
@LowerLoop:
lodsb
cmp al,'A'
jb @cont
cmp al,'Z'
ja @cont
add al,' '
@cont:
stosb
loop @LowerLoop
@empty:
pop ds
end; { LoStr }
function UpStr(const s:string):string; assembler;
asm
push ds
lds si,s
les di,@result
lodsb { load and store length of string }
stosb
xor ch,ch
mov cl,al
jcxz @empty { FIX for null length string }
@upperLoop:
lodsb
cmp al,'a'
jb @cont
cmp al,'z'
ja @cont
sub al,' '
@cont:
stosb
loop @UpperLoop
@empty:
pop ds
end; { UpStr }
VAR S : String;
BEGIN
ClrScr;
WriteLn(LoStr('LEE BARKER'));
WriteLn(UpStr('lee barker'));
Readkey;
END.